{include file="common/header"}
<div class="content-wrapper">
    {include file="task/nav"/}
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="nav-tabs-custom">
                    {include file="task/tabs"/}
                    <div class="tab-content">
                        <form method="post" class="form-horizontal form" id="post_form">
                            <div class="panel panel-info">
                                <div class="panel-heading">
                                    任务详情
                                </div>
                                <div class="panel-body">
                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">用户名</label>
                                        <div class="col-sm-6 col-xs-12" style="padding-top: 7px;">
                                            {$item['username']}
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">发布类型</label>
                                        <div class="col-sm-6 col-xs-12" style="padding-top: 7px;">
                                            <select  name="category_id">
                                                {if !empty($categorylist)}
                                                    {volist name="categorylist" id="clist"}
                                                        {if $clist['id']==$item['category_id']}
                                                            <option value="{$clist['id']}" selected>{$clist['title']}</option>
                                                        {else/}
                                                            <option value="{$clist['id']}" >{$clist['title']}</option>
                                                        {/if}
                                                    {/volist}
                                                {/if}
                                            </select>

                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">应用名称</label>
                                        <div class="col-sm-6 col-xs-12" style="padding-top: 7px;">
                                            <input type="text" class="form-control" name="appName" value="{$item['appName']?$item['appName']:''}" placeholder="请输入应用名称">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">标题</label>
                                        <div class="col-sm-6 col-xs-12">
                                            <input type="text" class="form-control" name="title" value="{$item['title']?$item['title']:''}" placeholder="请输入分类名称">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">审核状态</label>
                                        <div class="col-sm-6 col-xs-12" style="padding-top: 7px;">
                                            {if $item['is_display'] == 0}
                                            <label class="label label-info">待审核</label>
                                            {elseif $item['is_display'] == 1}
                                            <label class="label label-success">已审核</label>
                                            {else}
                                            <label class="label label-danger">审核未通过</label>
                                            {/if}
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">开始时间</label>
                                        <div class="col-sm-6 col-xs-12" style="padding-top: 7px;">
                                            {$item['start_time']}
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">结束时间</label>
                                        <div class="col-sm-6 col-xs-12" style="padding-top: 7px;">
                                            {$item['end_time']}
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">任务时间</label>
                                        <div class="col-sm-6 col-xs-12" style="padding-top: 7px;">
                                            <input type="number" class="form-control" name="task_time" value="{$item['task_time']?$item['task_time']:''}" placeholder="请输入任务时间">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">审核时间</label>
                                        <div class="col-sm-6 col-xs-12" style="padding-top: 7px;">
                                            <input type="number" class="form-control" name="task_checkout_time" value="{$item['task_checkout_time']?$item['task_checkout_time']:''}" placeholder="请输入审核时间">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">任务单价</label>
                                        <div class="col-sm-6 col-xs-12" style="padding-top: 7px;">
                                            <label class="label label-success">{$item['unit_price']}</label>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">任务数量</label>
                                        <div class="col-sm-6 col-xs-12" style="padding-top: 7px;">
                                            {$item['ticket_num']}
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">服务费用</label>
                                        <div class="col-sm-6 col-xs-12" style="padding-top: 7px;">
                                            <label class="label label-success">{$item['fee_money']}</label>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">任务总额</label>
                                        <div class="col-sm-6 col-xs-12" style="padding-top: 7px;">
                                            <label class="label label-success">{$item['amount']}</label>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">奖励积分</label>
                                        <div class="col-sm-6 col-xs-12" style="padding-top: 7px;">
                                            <label class="label label-success">{$item['give_credit1']}</label>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">任务地址</label>
                                        <div class="col-sm-6 col-xs-12" style="padding-top: 7px;">
                                            {$item['about_url']}
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">任务需求</label>
                                        <div class="col-sm-6 col-xs-12" style="padding-top: 7px;">
                                            {$item['detail']|nl2br}
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">发布时间</label>
                                        <div class="col-sm-6 col-xs-12" style="padding-top: 7px;">
                                            {$item['create_time']}
                                        </div>
                                    </div>
                                  
                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">审核状态</label>
                                        <div class="col-sm-6 col-xs-12">
                                            <label class="radio-inline">
                                                <input type="radio" name="is_display" {if 1==$item['is_display']}checked{/if} value="1">
                                                已审核
                                            </label>
                                            <label class="radio-inline">
                                                <input type="radio" name="is_display" {if -1==$item['is_display']}checked{/if} value="-1">
                                                审核未通过
                                            </label>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">审核备注</label>
                                        <div class="col-sm-6 col-xs-12">
                                            <textarea class="form-control" id="audit_remarks" name="audit_remarks" maxlength="1000" rows="5" placeholder="请输入审核备注">{$item['audit_remarks']?$item['audit_remarks']:''}</textarea>
                                        </div>
                                    </div>
                                    {//if $origin['admin_id'] == 0}
                                    <div class="form-group">
                                        <div class="col-sm-6 col-xs-12 col-sm-offset-2">
                                            <input type="hidden" name="id" value="{$item['id']?$item['id']:0}">
                                            <button type="button" id="submit" name="submit" class="btn btn-primary">提交</button>
                                        </div>
                                    </div>
                                    {///if}
                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">审核图样</label>
                                        <div class="col-sm-6 col-xs-12" style="padding-top: 7px;">
                                            <div class="clearfix">
                                            {if !empty($item['thumbs'])}
                                            {volist name="item['thumbs']" id="thumb"}
                                            <div class="input-group pull-left" style="margin-top:.5em;margin-right:.5em;">
                                                <a href="{$thumb}" target="_blank">
                                                <img src="{$thumb}" onerror="this.src='/static/admin/web/images/nopic.jpg'; this.title='图片未找到.'" class="img-responsive img-thumbnail" width="150">
                                                </a>
                                            </div>
                                            {/volist}
                                            {/if}
                                            </div>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">操作说明</label>
                                        <div class="col-sm-6 col-xs-12" style="padding-top: 7px;">
                                            {if !empty($operate_steps)}
                                            <div class="clearfix">
                                                {volist name="operate_steps" key="k" id="operate_step"}
                                                <div class="replies-list" style="margin-bottom: 0; font-size: 13px;">
                                                    <div class="user-s cl">
                                                        步骤{$k}
                                                    </div>
                                                    <div class="replies-desc">
                                                        <p><span style="color:#E84C3D;"></span></p>
                                                        <p mode="wrap" style="font-size: 13px;">{$operate_step.content}</p>
                                                        {if !empty($operate_step.image)}
                                                        <p mode="wrap" style="font-size: 13px;"><a href="{$operate_step.image}" target="_blank"><img src="{$operate_step.image}" width="150"></a></p>
                                                        {/if}
                                                    </div>
                                                    <div class="replies-img cl"></div>
                                                </div>
                                                {/volist}
                                            </div>
                                            {/if}
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </form>
                        <link rel="stylesheet" href="/static/plugins/dialog/css/dialog.css" />
                        <script src="/static/plugins/dialog/js/dialog.js"></script>
                        <style type="text/css">
                            .dialog {
                              position: fixed;
                              left: 0;
                              top: 0;
                              z-index: 10001;
                              width: 100%;
                              height: 100%;
                            }
                            .dialog-content {
                                width: 200px;
                            }
                            .dialog-overlay {
                              position: absolute;
                              top: 0;
                              left: 0;
                              z-index: 10002;
                              width: 100%;
                              height: 100%;
                              background-color: rgba(0, 0, 0, 0.5);
                            }
                        </style>
                        <script type="text/javascript">
                            $(function () {
                                $("#submit").click(function () {
                                    var val=$('input:radio[name="is_display"]:checked').val();
                                    var len_appname=$('input[name="appName"]').val();
                                     if(val==null){

                                         $(document).dialog({
                                             titleText: '任务审核',
                                             content: '还未选择审核状态',
                                         });
                                        return;
                                    }
                                    if (len_appname.length>6)
                                    {
                                        $(document).dialog({
                                            titleText: '应用名称检查',
                                            content: '应用名称大于6，超过允许值',
                                        });
                                        return;
                                    }
                                    {if $origin['admin_id'] == 0}
                                    $(document).dialog({
                                        type : 'confirm',
                                        titleText: '任务审核',
                                        content: '确定要审核此任务吗？审核后无法修改。',
                                        onClickConfirmBtn: function(){
                                            $.post(
                                                '/admin/task/save',
                                                $('#post_form').serialize(),
                                                function (res) {
                                                    message(res.message,res.redirect,res.type)
                                                },'json'
                                            );
                                        }
                                    });
                                    {else/}
                                        $(document).dialog({
                                            type : 'confirm',
                                            titleText: '重新提交',
                                            content: '确定要修改此任务状态吗？',
                                            onClickConfirmBtn: function(){
                                                $.post(
                                                    '/admin/task/save',
                                                    $('#post_form').serialize(),
                                                    function (res) {
                                                        message(res.message,res.redirect,res.type)
                                                    },'json'
                                                );
                                            }
                                        });
                                    {/if}
                                });
                            });
                        </script>
                    </div>
                    <!-- /.tab-content -->
                </div>
                <!-- /.nav-tabs-custom -->
            </div>
            <!-- /.col -->
        </div>
    </section>
</div>
{include file='common/ufooter'}
